<%@ page pageEncoding="UTF-8"%>
<%@ taglib prefix="isperp" uri="/WEB-INF/tlds/isperp.tld"%>
 
<isperp:grid url="incident/incident/listDetail" gridId="incidentGrid"
	processKey="incidentProcess" sortname="code" sortorder="desc"
	ondbClickRowEvent="incidentGrid.edit(rowid);"
	loadComplete="isperp.loadMessageCount(data);"
	cusViewUrl="incident/incident/view"  autoReloadTreeMenu="incidentMenu"
	excelExportUrl="incident/incident/excelExport">

	<jsp:attribute name="toolbar">
	<isperp:treeMenu id="incidentMenu" targetGridId="incidentGrid">
		<isperp:async enable="true" url="incident/incident/processMenu"></isperp:async>
		<isperp:callback onClick="incidentMenuTree_onNodeClick"
				onAsyncSuccess="incidentMenuTree_onNodeClickFirst();">
		</isperp:callback>
	</isperp:treeMenu>
	<isperp:toolbar id="userToolbar">
		
	</isperp:toolbar>
	</jsp:attribute>

	<jsp:attribute name="searchbar">
	<table class="search-table">
		<tbody>
			<tr>
				<td class="td1">编号：</td>
				<td class="td2"><input type="text" field="code" op="cn">
					</td>
				<td class="td1">标题：</td>
				<td class="td2"><input type="text" field="title" op="cn">
					</td>
				<td class="td1">分类：</td>
				<td class="td2"><input type="text" field="icd_category_name"
						op="cn">
				</td>
			</tr>
			<tr>
				<td class="td1">请求人：</td>
				<td class="td2"><input type="text" field="cus_user_name"
						op="cn">
					</td>
				<td class="td1">登记时间：</td>
				<td class="td2"><input id="createDateStart" type="date"
						field="create_date" op="gt" style="width: 68px" />~<input
						id="createDateEnd" type="date" field="create_date" op="lt"
						style="width: 68px" />
				</td> 
			 
				<td class="td1">事件状态：</td>
				<td class="td2">
				<isperp:dictSelector id="test" field="status" op="cn"
							typeCode="INCIDENT_STATUS"></isperp:dictSelector>
			
				</td>
			 
			</tr>
			
		</tbody>
	</table>
	</jsp:attribute>
	<jsp:body>
	<isperp:column name="id" title="" hidden="true"></isperp:column>
	
	<isperp:column name="sla_status" title="" hidden="true"></isperp:column>
	<isperp:column name="priority_name" title="" width="35"
			isFormatterFun="true" formatter="return statusFormatter(rowObject);">
	</isperp:column>
	<isperp:column name="code" title="编号" width="100">
	</isperp:column>
	<isperp:column name="title" title="标题" width="120">
	</isperp:column>
	<isperp:column name="icd_category_name" title="事件类型" width="120">
	</isperp:column>
	<isperp:column name="incident_type" title="性质" width="70">
	</isperp:column>
	<isperp:column name="cus_customer_name" title="申报单位" width="70">
	</isperp:column>
	<isperp:column name="cus_user_name" title="申报人" width="80">
	</isperp:column>
	<isperp:column name="create_date" title="登记时间" width="100">
	</isperp:column>
	<isperp:column name="status" title="状态" width="80"
			isFormatterFun="true"
			formatter="return statusNameFormatter(rowObject);">
	</isperp:column>
	</jsp:body>
</isperp:grid>

<isperp:operate code="INC_HANDLE"></isperp:operate>

<script type="text/javascript">
	function statusFormatter(rowObject) {
		var p = 0, html = "", title = "";
		if (rowObject.priority_name != null) {

			switch (rowObject.priority_name) {
			case "一级":
				p = 1;
				break;
			case "二级":
				p = 2;
				break;
			case "三级":
				p = 3;
				break;
			case "四级":
				p = 4;
				break;
			case "五级":
				p = 5;
				break;

			}
			title = "优先级：" + p + "级";
		} else {
			rowObject.priority_name = "未确定优先级";
			title = "未确定优先级";
		}

		html = "<img title='"+title+"' src='img/incident/p"+p+".png'>" ;
		if (rowObject.sla_status == 1) {

			html = html + "&nbsp;<img title='SLA：异常'  src='img/incident/sla_unusual.png'>";
		}

		return html + "&nbsp;<a id='msg_" + rowObject.id + "' href=\"javascript:openRelationMessage('" + rowObject.id + "')\" class=''></a>";
	}

	function openRelationMessage(id) {

		isperp.openDialog({
			title : "查看消息",
			contentUrl : "app/message/relationMessageView?all=1&sourceId=" + id
		});
	}

	function statusNameFormatter(rowObject) {
		title = "";
		if (rowObject.status != null && rowObject.status == '已解决') {

			if (rowObject.are_feedback != null && rowObject.are_feedback) {
				title = rowObject.status + "【已评价】";
			} else {
				title = rowObject.status + "【未评价】";
			}
		} else {
			title = rowObject.status;
		}
		return title;
	}
</script>